3.205 \(\int \tan ^4(e+f x) (a+b \tan ^2(e+f x))^2 \, dx\)

Optimal. Leaf size=91 \[ \frac{b (2 a-b) \tan ^5(e+f x)}{5 f}+\frac{(a-b)^2 \tan ^3(e+f x)}{3 f}-\frac{(a-b)^2 \tan (e+f x)}{f}+x (a-b)^2+\frac{b^2 \tan ^7(e+f x)}{7 f} \]

[Out]

(a - b)^2*x - ((a - b)^2*Tan[e + f*x])/f + ((a - b)^2*Tan[e + f*x]^3)/(3*f) + ((2*a - b)*b*Tan[e + f*x]^5)/(5*
f) + (b^2*Tan[e + f*x]^7)/(7*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0788437, antiderivative size = 91, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.13, Rules used = {3670, 461, 203} \[ \frac{b (2 a-b) \tan ^5(e+f x)}{5 f}+\frac{(a-b)^2 \tan ^3(e+f x)}{3 f}-\frac{(a-b)^2 \tan (e+f x)}{f}+x (a-b)^2+\frac{b^2 \tan ^7(e+f x)}{7 f} \]

Antiderivative was successfully verified.

[In]

Int[Tan[e + f*x]^4*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

(a - b)^2*x - ((a - b)^2*Tan[e + f*x])/f + ((a - b)^2*Tan[e + f*x]^3)/(3*f) + ((2*a - b)*b*Tan[e + f*x]^5)/(5*
f) + (b^2*Tan[e + f*x]^7)/(7*f)

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rule 461

Int[(((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_))/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Int[ExpandIntegr
and[((e*x)^m*(a + b*x^n)^p)/(c + d*x^n), x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && IGtQ[n
, 0] && IGtQ[p, 0] && (IntegerQ[m] || IGtQ[2*(m + 1), 0] ||  !RationalQ[m])

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \tan ^4(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac{\operatorname{Subst}\left (\int \frac{x^4 \left (a+b x^2\right )^2}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{\operatorname{Subst}\left (\int \left (-(a-b)^2+(a-b)^2 x^2+(2 a-b) b x^4+b^2 x^6+\frac{a^2-2 a b+b^2}{1+x^2}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac{(a-b)^2 \tan (e+f x)}{f}+\frac{(a-b)^2 \tan ^3(e+f x)}{3 f}+\frac{(2 a-b) b \tan ^5(e+f x)}{5 f}+\frac{b^2 \tan ^7(e+f x)}{7 f}+\frac{(a-b)^2 \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=(a-b)^2 x-\frac{(a-b)^2 \tan (e+f x)}{f}+\frac{(a-b)^2 \tan ^3(e+f x)}{3 f}+\frac{(2 a-b) b \tan ^5(e+f x)}{5 f}+\frac{b^2 \tan ^7(e+f x)}{7 f}\\ \end{align*}

Mathematica [B]  time = 0.0743482, size = 190, normalized size = 2.09 \[ \frac{a^2 \tan ^3(e+f x)}{3 f}+\frac{a^2 \tan ^{-1}(\tan (e+f x))}{f}-\frac{a^2 \tan (e+f x)}{f}+\frac{2 a b \tan ^5(e+f x)}{5 f}-\frac{2 a b \tan ^3(e+f x)}{3 f}-\frac{2 a b \tan ^{-1}(\tan (e+f x))}{f}+\frac{2 a b \tan (e+f x)}{f}+\frac{b^2 \tan ^7(e+f x)}{7 f}-\frac{b^2 \tan ^5(e+f x)}{5 f}+\frac{b^2 \tan ^3(e+f x)}{3 f}+\frac{b^2 \tan ^{-1}(\tan (e+f x))}{f}-\frac{b^2 \tan (e+f x)}{f} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[e + f*x]^4*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

(a^2*ArcTan[Tan[e + f*x]])/f - (2*a*b*ArcTan[Tan[e + f*x]])/f + (b^2*ArcTan[Tan[e + f*x]])/f - (a^2*Tan[e + f*
x])/f + (2*a*b*Tan[e + f*x])/f - (b^2*Tan[e + f*x])/f + (a^2*Tan[e + f*x]^3)/(3*f) - (2*a*b*Tan[e + f*x]^3)/(3
*f) + (b^2*Tan[e + f*x]^3)/(3*f) + (2*a*b*Tan[e + f*x]^5)/(5*f) - (b^2*Tan[e + f*x]^5)/(5*f) + (b^2*Tan[e + f*
x]^7)/(7*f)

________________________________________________________________________________________

Maple [B]  time = 0.005, size = 179, normalized size = 2. \begin{align*}{\frac{{b}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{7}}{7\,f}}+{\frac{2\, \left ( \tan \left ( fx+e \right ) \right ) ^{5}ab}{5\,f}}-{\frac{{b}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{5}}{5\,f}}+{\frac{ \left ( \tan \left ( fx+e \right ) \right ) ^{3}{a}^{2}}{3\,f}}-{\frac{2\, \left ( \tan \left ( fx+e \right ) \right ) ^{3}ab}{3\,f}}+{\frac{{b}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{3}}{3\,f}}-{\frac{{a}^{2}\tan \left ( fx+e \right ) }{f}}+2\,{\frac{\tan \left ( fx+e \right ) ab}{f}}-{\frac{{b}^{2}\tan \left ( fx+e \right ) }{f}}+{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ){a}^{2}}{f}}-2\,{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) ab}{f}}+{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ){b}^{2}}{f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(f*x+e)^4*(a+b*tan(f*x+e)^2)^2,x)

[Out]

1/7*b^2*tan(f*x+e)^7/f+2/5/f*tan(f*x+e)^5*a*b-1/5*b^2*tan(f*x+e)^5/f+1/3/f*tan(f*x+e)^3*a^2-2/3/f*tan(f*x+e)^3
*a*b+1/3*b^2*tan(f*x+e)^3/f-1/f*a^2*tan(f*x+e)+2*a*b*tan(f*x+e)/f-b^2*tan(f*x+e)/f+1/f*arctan(tan(f*x+e))*a^2-
2/f*arctan(tan(f*x+e))*a*b+1/f*arctan(tan(f*x+e))*b^2

________________________________________________________________________________________

Maxima [A]  time = 1.63475, size = 131, normalized size = 1.44 \begin{align*} \frac{15 \, b^{2} \tan \left (f x + e\right )^{7} + 21 \,{\left (2 \, a b - b^{2}\right )} \tan \left (f x + e\right )^{5} + 35 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )^{3} + 105 \,{\left (a^{2} - 2 \, a b + b^{2}\right )}{\left (f x + e\right )} - 105 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )}{105 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)^4*(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

1/105*(15*b^2*tan(f*x + e)^7 + 21*(2*a*b - b^2)*tan(f*x + e)^5 + 35*(a^2 - 2*a*b + b^2)*tan(f*x + e)^3 + 105*(
a^2 - 2*a*b + b^2)*(f*x + e) - 105*(a^2 - 2*a*b + b^2)*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [A]  time = 1.17075, size = 238, normalized size = 2.62 \begin{align*} \frac{15 \, b^{2} \tan \left (f x + e\right )^{7} + 21 \,{\left (2 \, a b - b^{2}\right )} \tan \left (f x + e\right )^{5} + 35 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )^{3} + 105 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} f x - 105 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )}{105 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)^4*(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

1/105*(15*b^2*tan(f*x + e)^7 + 21*(2*a*b - b^2)*tan(f*x + e)^5 + 35*(a^2 - 2*a*b + b^2)*tan(f*x + e)^3 + 105*(
a^2 - 2*a*b + b^2)*f*x - 105*(a^2 - 2*a*b + b^2)*tan(f*x + e))/f

________________________________________________________________________________________

Sympy [A]  time = 1.28952, size = 165, normalized size = 1.81 \begin{align*} \begin{cases} a^{2} x + \frac{a^{2} \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac{a^{2} \tan{\left (e + f x \right )}}{f} - 2 a b x + \frac{2 a b \tan ^{5}{\left (e + f x \right )}}{5 f} - \frac{2 a b \tan ^{3}{\left (e + f x \right )}}{3 f} + \frac{2 a b \tan{\left (e + f x \right )}}{f} + b^{2} x + \frac{b^{2} \tan ^{7}{\left (e + f x \right )}}{7 f} - \frac{b^{2} \tan ^{5}{\left (e + f x \right )}}{5 f} + \frac{b^{2} \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac{b^{2} \tan{\left (e + f x \right )}}{f} & \text{for}\: f \neq 0 \\x \left (a + b \tan ^{2}{\left (e \right )}\right )^{2} \tan ^{4}{\left (e \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)**4*(a+b*tan(f*x+e)**2)**2,x)

[Out]

Piecewise((a**2*x + a**2*tan(e + f*x)**3/(3*f) - a**2*tan(e + f*x)/f - 2*a*b*x + 2*a*b*tan(e + f*x)**5/(5*f) -
 2*a*b*tan(e + f*x)**3/(3*f) + 2*a*b*tan(e + f*x)/f + b**2*x + b**2*tan(e + f*x)**7/(7*f) - b**2*tan(e + f*x)*
*5/(5*f) + b**2*tan(e + f*x)**3/(3*f) - b**2*tan(e + f*x)/f, Ne(f, 0)), (x*(a + b*tan(e)**2)**2*tan(e)**4, Tru
e))

________________________________________________________________________________________

Giac [B]  time = 5.31017, size = 2273, normalized size = 24.98 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)^4*(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/105*(105*a^2*f*x*tan(f*x)^7*tan(e)^7 - 210*a*b*f*x*tan(f*x)^7*tan(e)^7 + 105*b^2*f*x*tan(f*x)^7*tan(e)^7 - 7
35*a^2*f*x*tan(f*x)^6*tan(e)^6 + 1470*a*b*f*x*tan(f*x)^6*tan(e)^6 - 735*b^2*f*x*tan(f*x)^6*tan(e)^6 + 105*a^2*
tan(f*x)^7*tan(e)^6 - 210*a*b*tan(f*x)^7*tan(e)^6 + 105*b^2*tan(f*x)^7*tan(e)^6 + 105*a^2*tan(f*x)^6*tan(e)^7
- 210*a*b*tan(f*x)^6*tan(e)^7 + 105*b^2*tan(f*x)^6*tan(e)^7 + 2205*a^2*f*x*tan(f*x)^5*tan(e)^5 - 4410*a*b*f*x*
tan(f*x)^5*tan(e)^5 + 2205*b^2*f*x*tan(f*x)^5*tan(e)^5 - 35*a^2*tan(f*x)^7*tan(e)^4 + 70*a*b*tan(f*x)^7*tan(e)
^4 - 35*b^2*tan(f*x)^7*tan(e)^4 - 735*a^2*tan(f*x)^6*tan(e)^5 + 1470*a*b*tan(f*x)^6*tan(e)^5 - 735*b^2*tan(f*x
)^6*tan(e)^5 - 735*a^2*tan(f*x)^5*tan(e)^6 + 1470*a*b*tan(f*x)^5*tan(e)^6 - 735*b^2*tan(f*x)^5*tan(e)^6 - 35*a
^2*tan(f*x)^4*tan(e)^7 + 70*a*b*tan(f*x)^4*tan(e)^7 - 35*b^2*tan(f*x)^4*tan(e)^7 - 3675*a^2*f*x*tan(f*x)^4*tan
(e)^4 + 7350*a*b*f*x*tan(f*x)^4*tan(e)^4 - 3675*b^2*f*x*tan(f*x)^4*tan(e)^4 - 42*a*b*tan(f*x)^7*tan(e)^2 + 21*
b^2*tan(f*x)^7*tan(e)^2 + 140*a^2*tan(f*x)^6*tan(e)^3 - 490*a*b*tan(f*x)^6*tan(e)^3 + 245*b^2*tan(f*x)^6*tan(e
)^3 + 1995*a^2*tan(f*x)^5*tan(e)^4 - 4410*a*b*tan(f*x)^5*tan(e)^4 + 2205*b^2*tan(f*x)^5*tan(e)^4 + 1995*a^2*ta
n(f*x)^4*tan(e)^5 - 4410*a*b*tan(f*x)^4*tan(e)^5 + 2205*b^2*tan(f*x)^4*tan(e)^5 + 140*a^2*tan(f*x)^3*tan(e)^6
- 490*a*b*tan(f*x)^3*tan(e)^6 + 245*b^2*tan(f*x)^3*tan(e)^6 - 42*a*b*tan(f*x)^2*tan(e)^7 + 21*b^2*tan(f*x)^2*t
an(e)^7 + 3675*a^2*f*x*tan(f*x)^3*tan(e)^3 - 7350*a*b*f*x*tan(f*x)^3*tan(e)^3 + 3675*b^2*f*x*tan(f*x)^3*tan(e)
^3 - 15*b^2*tan(f*x)^7 + 84*a*b*tan(f*x)^6*tan(e) - 147*b^2*tan(f*x)^6*tan(e) - 210*a^2*tan(f*x)^5*tan(e)^2 +
840*a*b*tan(f*x)^5*tan(e)^2 - 735*b^2*tan(f*x)^5*tan(e)^2 - 2730*a^2*tan(f*x)^4*tan(e)^3 + 6300*a*b*tan(f*x)^4
*tan(e)^3 - 3675*b^2*tan(f*x)^4*tan(e)^3 - 2730*a^2*tan(f*x)^3*tan(e)^4 + 6300*a*b*tan(f*x)^3*tan(e)^4 - 3675*
b^2*tan(f*x)^3*tan(e)^4 - 210*a^2*tan(f*x)^2*tan(e)^5 + 840*a*b*tan(f*x)^2*tan(e)^5 - 735*b^2*tan(f*x)^2*tan(e
)^5 + 84*a*b*tan(f*x)*tan(e)^6 - 147*b^2*tan(f*x)*tan(e)^6 - 15*b^2*tan(e)^7 - 2205*a^2*f*x*tan(f*x)^2*tan(e)^
2 + 4410*a*b*f*x*tan(f*x)^2*tan(e)^2 - 2205*b^2*f*x*tan(f*x)^2*tan(e)^2 - 42*a*b*tan(f*x)^5 + 21*b^2*tan(f*x)^
5 + 140*a^2*tan(f*x)^4*tan(e) - 490*a*b*tan(f*x)^4*tan(e) + 245*b^2*tan(f*x)^4*tan(e) + 1995*a^2*tan(f*x)^3*ta
n(e)^2 - 4410*a*b*tan(f*x)^3*tan(e)^2 + 2205*b^2*tan(f*x)^3*tan(e)^2 + 1995*a^2*tan(f*x)^2*tan(e)^3 - 4410*a*b
*tan(f*x)^2*tan(e)^3 + 2205*b^2*tan(f*x)^2*tan(e)^3 + 140*a^2*tan(f*x)*tan(e)^4 - 490*a*b*tan(f*x)*tan(e)^4 +
245*b^2*tan(f*x)*tan(e)^4 - 42*a*b*tan(e)^5 + 21*b^2*tan(e)^5 + 735*a^2*f*x*tan(f*x)*tan(e) - 1470*a*b*f*x*tan
(f*x)*tan(e) + 735*b^2*f*x*tan(f*x)*tan(e) - 35*a^2*tan(f*x)^3 + 70*a*b*tan(f*x)^3 - 35*b^2*tan(f*x)^3 - 735*a
^2*tan(f*x)^2*tan(e) + 1470*a*b*tan(f*x)^2*tan(e) - 735*b^2*tan(f*x)^2*tan(e) - 735*a^2*tan(f*x)*tan(e)^2 + 14
70*a*b*tan(f*x)*tan(e)^2 - 735*b^2*tan(f*x)*tan(e)^2 - 35*a^2*tan(e)^3 + 70*a*b*tan(e)^3 - 35*b^2*tan(e)^3 - 1
05*a^2*f*x + 210*a*b*f*x - 105*b^2*f*x + 105*a^2*tan(f*x) - 210*a*b*tan(f*x) + 105*b^2*tan(f*x) + 105*a^2*tan(
e) - 210*a*b*tan(e) + 105*b^2*tan(e))/(f*tan(f*x)^7*tan(e)^7 - 7*f*tan(f*x)^6*tan(e)^6 + 21*f*tan(f*x)^5*tan(e
)^5 - 35*f*tan(f*x)^4*tan(e)^4 + 35*f*tan(f*x)^3*tan(e)^3 - 21*f*tan(f*x)^2*tan(e)^2 + 7*f*tan(f*x)*tan(e) - f
)